public class J05Luoji {
    public static void main(String[] args) {
        // 逻辑与 &(逻辑与，and符)
        boolean b1 = true & true;
        System.out.println("b1 = " + b1);
        System.out.println(false & true);
        System.out.println(true & false);
        System.out.println(false & false);

        boolean b2 = (3>2) & (5!=5);
        System.out.println("b2 = " + b2);

        System.out.println("===逻辑或===");
        System.out.println(true | true);
        System.out.println(false | true);
        System.out.println(true | false);
        System.out.println(false | false);
    }
}

class Luoji2{
    public static void main(String[] args) {
        System.out.println("==异或==");
        System.out.println(true ^ true);//false
        System.out.println(true ^ false);//true

        System.out.println(!true);
        System.out.println(!false);
        boolean b1 = true;
        System.out.println(!b1);//false
    }
}
class Luoji3{
    public static void main(String[] args) {
        System.out.println(true && true);//true

        System.out.println(false && true);//false  效率高
        System.out.println(false & true);//false   效率低

        System.out.println("=====");
        int age = 3;
//        System.out.println(false & (age++>2)); // 往后走    4
        System.out.println(false && (age++>2)); // 不往后走，短路  3
        System.out.println("age = " + age);//

        int num = 5;
//        System.out.println(true || false);
//        System.out.println(true || (num-->0));//5
        System.out.println(true | (num-->0));//4
        System.out.println("num = " + num);
    }
}

